package com.imut.controller;

import com.imut.entity.Account;
import com.imut.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/account")
public class AccountController extends BaseController{

    @Autowired
    private AccountService accountService;

    @PostMapping
    public boolean insertAll(@RequestBody Account book) {
        return accountService.insertAll(book);
    }

    @PutMapping
    public boolean updateById(@RequestBody Account book) {
        return accountService.updateById(book);
    }

    @DeleteMapping("/{id}")
    public boolean deleteById(@PathVariable Integer id) {
        return accountService.deleteById(id);
    }

    @GetMapping("/{id}")
    public Account selectById(@PathVariable Integer id) {
        return accountService.selectById(id);
    }

    @GetMapping
    public List<Account> selectAll() {
        return accountService.selectAll();
    }
}
